package calvin.study.springboot.config.ioc;

import javax.sql.DataSource;

import org.springframework.aop.Advisor;
import org.springframework.aop.TargetSource;
import org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator;
import org.springframework.beans.BeansException;

public class SeataAutoDataSourceProxyCreator extends AbstractAutoProxyCreator {

	/** TODO */
	private static final long serialVersionUID = 1L;
	
	  private final Advisor advisor =  null;

	@Override
	protected Object[] getAdvicesAndAdvisorsForBean(Class<?> beanClass, String beanName,
			TargetSource customTargetSource) throws BeansException {
		System.out.println("SeataAutoDataSourceProxyCreator getAdvicesAndAdvisorsForBean" + beanName);
		return new Object[]{advisor};
	}
	
    @Override
    protected boolean shouldSkip(Class<?> beanClass, String beanName) {
        return !DataSource.class.isAssignableFrom(beanClass);
    }

}
